!define SHORTNAME "qeda" ; Must be in lower case without spaces
!define FULLNAME "QEDA Opensource Electronic Design Automation Software" ; Software full name (anything except \/:*?"<>|)
!define VERSION "0.1.0"

Name "${FULLNAME} ${VERSION}"
OutFile "${SHORTNAME}-${VERSION}-setup.exe"
ShowInstDetails show
ShowUninstDetails show 

!include "MUI.nsh"

InstallDir $PROGRAMFILES\${SHORTNAME}

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "install_nsis.bmp"
!define MUI_ABORTWARNING

!define MUI_DIRECTORYPAGE_TEXT_TOP "Destination folder for our software"
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Folder for ${FULLNAME}"

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
  
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"

Section "Install" SecInstall
  SetOutPath "$INSTDIR"
  File "..\bin\qeda.exe"
  File "..\bin\mingwm10.dll"
  File "..\bin\libgcc_s_dw2-1.dll"
  File "..\bin\QtCore4.dll"
  File "..\bin\QtGui4.dll"
  ;SetOverwrite off
  ;File "settings.ini"
  ;SetOverwrite on

  ;Create uninstaller
  WriteUninstaller "$INSTDIR\unistall-${SHORTNAME}.exe"

  ; Desktop shortcut
  SetOutPath "$INSTDIR"
  createShortCut "$DESKTOP\${FULLNAME}.lnk" "$INSTDIR\${SHORTNAME}.exe"
SectionEnd

Section "Uninstall"
  Delete "$INSTDIR\${SHORTNAME}.exe"
  Delete "$INSTDIR\mingwm10.dll"
  Delete "$INSTDIR\libgcc_s_dw2-1.dll"
  Delete "$INSTDIR\QtCore4.dll"
  Delete "$INSTDIR\QtGui4.dll"
  ;Delete "$INSTDIR\default.ini"
  RMDir /r "$PROFILE\AppData\Local\VirtualStore\Program Files\${SHORTNAME}" ; For Windows 7

  Delete "$DESKTOP\${FULLNAME}.lnk"

  Delete "$INSTDIR\unistall-${SHORTNAME}.exe"
SectionEnd